import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:ct_pa_majordomo/pages/widgets/menu_block.dart";
import "package:ct_pa_majordomo/router/keys.dart";
import "package:ct_pa_majordomo/utils/stacker.dart";
import "package:ct_pa_majordomo/widgets/normal_scaffold/index.dart";
import "package:flutter/cupertino.dart";

class WaterElectricitySetting extends StatefulWidget {
  const WaterElectricitySetting({Key? key}) : super(key: key);

  @override
  State<WaterElectricitySetting> createState() => _WaterElectricitySettingState();
}

class _WaterElectricitySettingState extends State<WaterElectricitySetting> {
  @override
  Widget build(BuildContext context) {
    return NormalScaffold(
      title: "水电设置",
      child: Padding(
        padding: EdgeInsets.all(ThemeVars.paddingPage),
        child: Column(
          children: [
            MenuBlock(
              title: const Text("接口授权", style: TextStyle(fontSize: 12, color: ThemeVars.colorTextSec),),
              items: [
                MenuBlockItem(
                  text: "授权管理",
                  onTap: () {
                    Stacker.pushNamed(Keys.WATER_ELECTRICITY_AUTHORIZATION_MANAGEMENT);
                  }
                ),
              ],
            ),
            MenuBlock(
              title: const Text("电表设置", style: TextStyle(fontSize: 12, color: ThemeVars.colorTextSec),),
              items: [
                MenuBlockItem(
                  text: "电费单价设置",
                  onTap: () {
                    Stacker.pushNamed(Keys.WATER_ELECTRICITY_PRICE_SETTING).then((result) {
                      if (result == true) {
                        setState(() {}); // 刷新页面
                      }
                    });
                  }
                ),
              ],
            ),
          ],
        ),
      )
    );
  }
}